﻿<?php 
// 查看总留言信息页面
include 'comm.php';
if(!isset($_SESSION['user'])){
    show_msg("请先登录！","login.php");
}
$sql="select * from lyb_info";
$res=$conn->query($sql);
// 分页
$per_page=5;
if(!isset($_GET['page'])){
    $page=1;
}else {
    $page=$_GET['page'];
}
$total_ly=$res->num_rows;
$total_page=ceil($total_ly/$per_page);
$sql="select * from lyb_info limit ".($page-1)*$per_page.",".$per_page;
$res=$conn->query($sql);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
<TITLE>查看留言</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<STYLE type=text/css>BODY {
	MARGIN: 0px
}
</STYLE>
<LINK href="css/css.css" type=text/css rel=stylesheet>
<STYLE type=text/css>.STYLE1 {
	FONT-FAMILY: "宋体"
}
</STYLE>
<META content="MSHTML 6.00.2900.6003" name=GENERATOR>
</HEAD>
<BODY>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD
    style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid"
    vAlign=top width=140 bgColor=#eeeeee>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=left_bg2><A class=link3
            href="register.php">用户注册</A></TD></TR>
        <TR>
          <TD class=left_bg2><A class=link3
            href="login.php">用户登录</A></TD></TR>
        <TR>
        <TR>
          <TD class=left_bg2><A class=link3
            href="view.php">查看留言</A></TD></TR>
        <TR>
          <TD class=left_bg2><A class=link3
            href="lyb.php">在线留言</A></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD></TD></TR></TBODY></TABLE></TD>
    <TD vAlign=top width=8></TD>
    <TD vAlign=top>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=bt>查看留言</TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=10 width="100%" border=0>
        <TBODY>
        <TR>
          <TD height=350>
            <TABLE cellSpacing=1 cellPadding=6 width="100%" bgColor=#ff9900
            border=0>
              <TBODY>
              <TR>
                <TD
                bgColor=#fff2e6>请您在此处查看其他用户的留言并发表评论。</TD></TR></TBODY></TABLE><BR>
        	<TABLE borderColor=#111111 cellSpacing=0 cellPadding=4 width="100%" bgColor=#ffffff border=0>
              <tr><th>序号</th><th>标题</th><th>留言人</th><th>留言类型</th><th>留言时间</th></tr>
              <?php 
              $no=1;
              while ($row=$res->fetch_assoc()) {
                  echo "<tr align=center>";
                  echo "<td>".$no++."</td><td><a href='disp.php?id=".$row['lyb_id']."'>".$row['title']."</td><td>".$row['author']."</td>";
                  switch ($row['ly_type']) {
                      case 1:
                          echo "<td>求助</td>";
                          break;
                      
                      case 2:
                          echo "<td>建议</td>";
                          break;
                          
                      case 3:
                          echo "<td>投诉</td>";
                          break;
                          
                      case 4:
                          echo "<td>表扬</td>";
                          break;
                      case 5:
                          echo "<td>业务联系</td>";
                          break;
                  }
                  echo "<td>".$row['ly_time']."</td>";
                  echo "</tr>";
              }
              if($page==1){
                  echo "<tr align=center><td colspan=5><a href='view.php?page=1'>【首页】</a>【上一页】<a href='view.php?page=".($page+1)."'>【下一页】</a><a href='view.php?page=".$total_page."'>【尾页】</a></td></tr>";
              }elseif ($page==$total_page){
                  echo "<tr align=center><td colspan=5><a href='view.php?page=1'>【首页】</a><a href='view.php?page=".($page-1)."'>【上一页】</a>【下一页】<a href='view.php?page=".$total_page."'>【尾页】</a></td></tr>";
              }else {
                  echo "<tr align=center><td colspan=5><a href='view.php?page=1'>【首页】</a><a href='view.php?page=".($page-1)."'>【上一页】</a><a href='view.php?page=".($page+1)."'>【下一页】</a><a href='view.php?page=".$total_page."'>【尾页】</a></td></tr>";
              }
              ?>
          </TABLE>
     </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</BODY>   
</HTML>
